package com.dz.control;

import com.dz.bean.roleFenlei;
import com.dz.dao.roleFenleiMapper;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class roleFenleiControl {
    @Resource
    private roleFenleiMapper roleFenleiMapper;

    @GetMapping("getSAllroleFenlei")
    @ResponseBody
    public List<roleFenlei> getSAllroleFenlei(){
       List<roleFenlei> list=  roleFenleiMapper.selectAllroleFenlei();
       return list;
    }
    @GetMapping("insertroleFenlei")
    @ResponseBody
    public int  insertroleFenlei(HttpServletRequest request){
        String quanxain=request.getParameter("username");
        roleFenlei r1=new roleFenlei();
        r1.setQuanxian(quanxain);
        int i= roleFenleiMapper.rolefenleiinsert(r1);
        return i;
    }
    @RequestMapping("deleteroleFenlei")
    @ResponseBody
    public int  deleteroleFenlei(HttpServletRequest request){
        String ids=request.getParameter("id");
        Integer id=Integer.valueOf(ids);
        int i= roleFenleiMapper.deleterolefenlei(id);
        return i;
    }
}
